home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6216 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  925 b 

  1. Path: news.iadfw.net!usenet
  2. From: alpet@airmail.net (Adam Peterson)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How to get program using Fork() and Pipe()
  5. Date: Fri, 23 Feb 1996 03:52:21 GMT
  6. Organization: customer of Internet America
  7. Message-ID: <4gj6p9$o0h@news-f.iadfw.net>
  8. References: <4gic02$6l0@news.mty.itesm.mx>
  9. NNTP-Posting-Host: dal24-12.ppp.iadfw.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. al535994@academ10.mty.itesm.mx (ARTURO RAFAEL LOPEZ CASTRO) wrote:
  13.  
  14. >I would like to know if someone could give program examples using fork and pipe because I have trouble using them.
  15.  
  16. >Thanks.
  17.  
  18. I don't have any sample code, but they shouldn't be to bad.  The fork
  19. and pipe basically create an identical copy of the running program.
  20. The only way for the code to tell which one it is, is to check the
  21. process's PID number before and after the fork.  If it hasn't changed,
  22. then it is the parent, otherwise it is the 2nd copy.
  23.  
  24. Adam
  25.  
  26.  
  27.